<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/

include_once '../connection/databaseHandler.php';
include_once '../connection/sessionHandler.php';
include_once '../classes/cProfile.php';
$database = new DatabaseHandler();
$session = new SessionHandler();

if (isset($_GET['id'])) {
    echo "<script>alert('haihai'); </script>";
    $act_username = $_GET['id'];
    $act_username = stripslashes($act_username);
    $act_username = mysql_real_escape_string($act_username);
    $query = "SELECT * FROM ".$database->t_user." WHERE username='".$act_username."'";
    $result = $database->execQuery($query);
    $count = mysql_num_rows($result);
    if($count==1) {
        $result = mysql_fetch_array($result);
        $actID = $result;
    }
    else {
        $actID = $session->activeUser;
    }
}
else {
    if (!$session->isLoggedIn) {
        header("location:index.php");
        die();
    }
    $actID = $session->activeUser;
}

$thisPage = new Profile($database,$session,$actID);


if ($_GET['page']==null) {
    $thisPage->genContentAJAX('profile');
}
else {
    $thisPage->genContentAJAX($_GET['page']);
}

?>
